import { Predicate } from '../Function'

/**
 * Collection
 * 收集
 * @author LL
 * @date 2022-01-23 上午 12:09
 **/
export interface Collection<E> {
    /**
     * 收集元素数量
     * @return {number}
     */
    size(): number

    /**
     * 当前收集器为空?
     * @return {boolean}
     */
    isEmpty(): boolean

    /**
     * 当前集合是否包含指定集合
     * @param o
     * @return {boolean}
     */
    contains(o: any): boolean

    toArray(): Array<E>

    add(e: E): boolean

    remove(o: any): boolean

    containsAll(coll: Collection<E>): boolean

    addAll(coll: Collection<E>): boolean

    removeIf(predicate: Predicate<E>): boolean

    retainAll(coll: Collection<E>): boolean

    clear(): void
}
